//Source file: D:\\test\\com\\ce\\pms\\charge\\model\\ParameterDef.java

package com.ce.pms.charge.model;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import com.ce.pms.common.model.SysInfo;
import com.sitechasia.webx.core.model.IDomainObject;

/**
 * 实体名称:参数配置 关联数据表:SEC_PARAMETER_DEF
 */
@Entity
@Table(name = "SEC_PARAMETER_DEF")
public class ParameterDefDomain implements IDomainObject{
	/**
	 * pvalue引用的交易码的外键
	 */
	public static final String PVALUE_TYPE_BUSSINESSCODE="bussinessCode";
	/**
	 * pvalue引用的收费项目的外键
	 */
	public static final String PVALUE_TYPE_CHARGEITEM="chargeItem";

	/**
	 * 组代码: 系统配置模块
	 */
	public static final  String GKEY_SYSTEM="1";
	/**
	 * 组代码: 房产模块
	 */
	public static final  String GKEY_HOUSE="2";
	/**
	 * 组代码: 客户服务模块
	 */
	public static final  String GKEY_CUSTOMERSERVICE="3";
	/**
	 * 组代码: 费用模块
	 */
	public static final  String GKEY_CHARGE="4";
	/**
	 * 主键
	 */
	@Id
	@GeneratedValue
	@Column(name = "PARAMETER_DEF_ID")
	private Long parameterDefId;

	/**
	 * 参数名称
	 */
	@Column(name = "PNAME", nullable = false, length = 50)
	private String pname;

	/**
	 * 参数代码
	 */
	@Column(name = "PKEY", nullable = false, length = 50)
	private String pkey;

	/**
	 * 关联实体键值
	 */
	@Column(name = "PVALUE", nullable = false)
	private Long pvalue;

	/**
	 * 说明
	 */
	@Column(name = "DESCRIPTION")
	private String description;

	/**
	 * 组代码: 001系统配置模块;002房产模块;003客服模块;004收费模块
	 */
	@Column(name = "GKEY")
	private String gkey;

	@Embedded
	private SysInfo sysInfo;

	/**
	 * @roseuid 48757D1501F4
	 */
	public ParameterDefDomain() {

	}
	/**
	 *  mini constructor
	 * @param pname    参数名称
	 * @param pkey     参数代码
	 * @param pvalue   关联实体键值
	 * @param sysInfo  系统信息
	 */
	public ParameterDefDomain(String pname, String pkey, Long pvalue, SysInfo sysInfo) {
		super();
		this.pname = pname;
		this.pkey = pkey;
		this.pvalue = pvalue;
		this.sysInfo = sysInfo;
	}

	/**
	 * 功能描述:返回pvalue的类型<br>
	 * @return<br>
	 * Create author:罗军林<br>
	 * Create on:2008-8-26<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	public String getPvalueType(){
		if(this.pkey!=null && (this.pkey.equals("LATEFEE_CODE")
				|| this.pkey.equals("MULTIPLE_PAY_CODE")
				|| this.pkey.equals("PRE_PAY_CODE")
				|| this.pkey.equals("BANK_PAID_CODE")
				|| this.pkey.equals("SEWAGE_CODE")
				|| this.pkey.equals("RUBBISH_CODE")
				|| this.pkey.equals("WATER_FEE_CODE")
				|| this.pkey.equals("ELECTRICAL_BILL_CODE")
				|| this.pkey.equals("MANAGEMENT_FEE_CODE")
				|| this.pkey.equals("MAIN_BODY_MAINTENANCE_FUND_CODE")
				|| this.pkey.equals("MAINTENANCE_COST_CODE")

				|| this.pkey.equals("DEPOSIT_CODE")
				|| this.pkey.equals("RENOVATE_AMERCEMENT_CODE")
				|| this.pkey.equals("CSUT_SERVICE_EVENT_CODE")
				|| this.pkey.equals("OCCUPATION_CHARGE_CODE")
				|| this.pkey.equals("DEPOSIT_PAY_CODE")
				)){
			return PVALUE_TYPE_BUSSINESSCODE;
		}else{
			return "";
		}
	}

	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getGkey() {
		return gkey;
	}
	public void setGkey(String gkey) {
		this.gkey = gkey;
	}
	public Long getParameterDefId() {
		return parameterDefId;
	}
	public void setParameterDefId(Long parameterDefId) {
		this.parameterDefId = parameterDefId;
	}
	public String getPkey() {
		return pkey;
	}
	public void setPkey(String pkey) {
		this.pkey = pkey;
	}
	public String getPname() {
		return pname;
	}
	public void setPname(String pname) {
		this.pname = pname;
	}
	public Long getPvalue() {
		return pvalue;
	}
	public void setPvalue(Long pvalue) {
		this.pvalue = pvalue;
	}
	public SysInfo getSysInfo() {
		return sysInfo;
	}
	public void setSysInfo(SysInfo sysInfo) {
		this.sysInfo = sysInfo;
	}

}
